<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>供需信息表编辑--${site.name}</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <meta name="description" content="${site.description}"/>
    <meta name="keywords" content="${site.keywords}"/>
    <meta name="author" content="${site.author}"/>
    <link rel="icon" href="${site.logo}">
    <link rel="stylesheet" href="${base}/static/layui/css/layui.css" media="all" />
    <style type="text/css">
        .layui-form-item .layui-inline{ width:33.333%; float:left; margin-right:0; }
        @media(max-width:1240px){
            .layui-form-item .layui-inline{ width:100%; float:none; }
        }
        .layui-form-item .role-box {
            position: relative;
        }
        .layui-form-item .role-box .jq-role-inline {
            height: 100%;
            overflow: auto;
        }

    </style>
</head>
<body class="childrenBody">
<form class="layui-form" style="width:80%;">
    <input value="${electricitySupply.id}" name="id" type="hidden">
    <div class="layui-form-item">
        <label class="layui-form-label">主键id</label>
        <div class="layui-input-block">
                <input  type="text" class="layui-input" value = "${electricitySupply.supplyId}" name="supplyId" lay-verify="required" placeholder="请输入主键id">

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">成员类型（继承于成员表）</label>
        <div class="layui-input-block">
                <input  type="text" class="layui-input" value = "${electricitySupply.userType}" name="userType" lay-verify="required" placeholder="请输入成员类型（继承于成员表）">

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">所在地（继承于成员表）</label>
        <div class="layui-input-block">
                <input  type="text" class="layui-input" value = "${electricitySupply.city}" name="city" lay-verify="required" placeholder="请输入所在地（继承于成员表）">

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">交易类型</label>
        <div class="layui-input-block">
                <select name="businessType" >
                    <option value="" selected="">请选择交易类型</option>
                    <@my type="electricity_supply_business_type">
                    <#list result as r>
                    <option value="${r.value}"  <#if (electricitySupply.businessType == r.value)> selected="" </#if>  >${r.label}</option>
                    </#list>
                    </@my>
                </select>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">交易时效</label>
        <div class="layui-input-block">
                <input type="hidden" class="layui-input" name="businessCycle" id="businessCycle" value = "${electricitySupply.businessCycle}" >
                <div class="layui-upload-drag" id="businessCycle">
                  <i class="layui-icon"></i>
                  <p>点击上传，或将文件拖拽到此处</p>
                </div>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">淘电品种</label>
        <div class="layui-input-block">
                <select name="amoyType" >
                    <option value="" selected="">请选择淘电品种</option>
                    <@my type="electricity_supply_amoy_type">
                    <#list result as r>
                    <option value="${r.value}"  <#if (electricitySupply.amoyType == r.value)> selected="" </#if>  >${r.label}</option>
                    </#list>
                    </@my>
                </select>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">淘电开始时间</label>
        <div class="layui-input-block">
                <input type="text" name="amoyBegintime" id="amoyBegintime" <#if (electricitySupply.amoyBegintime)??>value="${electricitySupply.amoyBegintime?string('yyyy-MM-dd')}"</#if>  lay-verify="date" placeholder="请选择淘电开始时间" autocomplete="off" class="layui-input">

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">淘电结束时间</label>
        <div class="layui-input-block">
                <input type="text" name="amoyEndtime" id="amoyEndtime" <#if (electricitySupply.amoyEndtime)??>value="${electricitySupply.amoyEndtime?string('yyyy-MM-dd')}"</#if>  lay-verify="date" placeholder="请选择淘电结束时间" autocomplete="off" class="layui-input">

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">淘电量（MWh）</label>
        <div class="layui-input-block">
                <input type="hidden" class="layui-input" name="amoyValue" id="amoyValue" value = "${electricitySupply.amoyValue}" >
                <div class="layui-upload-drag" id="amoyValue">
                  <i class="layui-icon"></i>
                  <p>点击上传，或将文件拖拽到此处</p>
                </div>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">淘电价</label>
        <div class="layui-input-block">
                <input type="hidden" class="layui-input" name="amoyPrice" id="amoyPrice" value = "${electricitySupply.amoyPrice}" >
                <div class="layui-upload-drag" id="amoyPrice">
                  <i class="layui-icon"></i>
                  <p>点击上传，或将文件拖拽到此处</p>
                </div>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">发布时间</label>
        <div class="layui-input-block">
                <input type="hidden" class="layui-input" name="publishTime" id="publishTime" value = "${electricitySupply.publishTime}" >
                <div class="layui-upload-drag" id="publishTime">
                  <i class="layui-icon"></i>
                  <p>点击上传，或将文件拖拽到此处</p>
                </div>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">交易时效（分钟）</label>
        <div class="layui-input-block">
                <input type="hidden" class="layui-input" name="businessTime" id="businessTime" value = "${electricitySupply.businessTime}" >
                <div class="layui-upload-drag" id="businessTime">
                  <i class="layui-icon"></i>
                  <p>点击上传，或将文件拖拽到此处</p>
                </div>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">审核状态</label>
        <div class="layui-input-block">
                <select name="auditingStatu" >
                    <option value="" selected="">请选择审核状态</option>
                    <@my type="electricity_supply_auditing_statu">
                    <#list result as r>
                    <option value="${r.value}"  <#if (electricitySupply.auditingStatu == r.value)> selected="" </#if>  >${r.label}</option>
                    </#list>
                    </@my>
                </select>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否被购买过</label>
        <div class="layui-input-block">
                <input type="hidden" class="layui-input" name="isbuying" id="isbuying" value = "${electricitySupply.isbuying}" >
                <div class="layui-upload-drag" id="isbuying">
                  <i class="layui-icon"></i>
                  <p>点击上传，或将文件拖拽到此处</p>
                </div>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">总淘电量</label>
        <div class="layui-input-block">
                <input type="hidden" class="layui-input" name="amoyValueSum" id="amoyValueSum" value = "${electricitySupply.amoyValueSum}" >
                <div class="layui-upload-drag" id="amoyValueSum">
                  <i class="layui-icon"></i>
                  <p>点击上传，或将文件拖拽到此处</p>
                </div>

        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-block">
                <input type="text" name="createTime" id="createTime" <#if (electricitySupply.createTime)??>value="${electricitySupply.createTime?string('yyyy-MM-dd')}"</#if>  lay-verify="date" placeholder="请选择创建时间" autocomplete="off" class="layui-input">

        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="addElectricitySupply">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>
<script type="text/javascript" src="${base}/static/layui/layui.js"></script>
<script>
    layui.use(['form','jquery','layer','laydate'],function(){
        var form      = layui.form,
                $     = layui.jquery,
                layer = layui.layer;

                          //初始赋值

                          laydate.render({
                            elem: '#amoyBegintime'
<#if (electricitySupply.amoyBegintime)??>
                            ,value: '${electricitySupply.amoyBegintime?string("yyyy-MM-dd")}'
</#if>
                          });

                          //初始赋值

                          laydate.render({
                            elem: '#amoyEndtime'
<#if (electricitySupply.amoyEndtime)??>
                            ,value: '${electricitySupply.amoyEndtime?string("yyyy-MM-dd")}'
</#if>
                          });

                          //初始赋值

                          laydate.render({
                            elem: '#createTime'
<#if (electricitySupply.createTime)??>
                            ,value: '${electricitySupply.createTime?string("yyyy-MM-dd")}'
</#if>
                          });


        form.on("submit(addElectricitySupply)",function(data){
                               if(null === data.field.amoyBegintime || "" ===data.field.amoyBegintime){
                                delete data.field["amoyBegintime"];
                            }else{
                                data.field.amoyBegintime = new Date(data.field.amoyBegintime);
                            }
                               if(null === data.field.amoyEndtime || "" ===data.field.amoyEndtime){
                                delete data.field["amoyEndtime"];
                            }else{
                                data.field.amoyEndtime = new Date(data.field.amoyEndtime);
                            }
                               if(null === data.field.createTime || "" ===data.field.createTime){
                                delete data.field["createTime"];
                            }else{
                                data.field.createTime = new Date(data.field.createTime);
                            }
            var loadIndex = layer.load(2, {
                shade: [0.3, '#333']
            });
            //给角色赋值
            $.post("${base}/admin/electricitySupply/edit",data.field,function(res){
                layer.close(loadIndex);
                if(res.success){
                    parent.layer.msg("供需信息表编辑成功！",{time:1000},function(){
                        parent.layer.close(parent.editIndex);
                        //刷新父页面
                        parent.location.reload();
                    });
                }else{
                    layer.msg(res.message);
                }
            });
            return false;
        });

    });
</script>
</body>
</html>